package com.ccc3gc.mysystem.service.impl;

import com.ccc3gc.mysystem.VO.StaffVO;
import com.ccc3gc.mysystem.bean.Staff;
import com.ccc3gc.mysystem.bean.User;
import com.ccc3gc.mysystem.mapper.StaffMapper;
import com.ccc3gc.mysystem.service.StaffService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StaffServiceImpl implements StaffService {
    @Autowired
    public StaffMapper staffMapper;
    /**
     * @return staffs
     */
    @Override
    public List<Staff> selectStaffList(Staff staff) {
        List<Staff> staffs = staffMapper.selectStaff(staff);
        return staffs;
    }

    /**通过Id查询配送员
     * @param staffId
     * @return
     */
    @Override
    public Staff SelectStaffById(int staffId) {
        Staff staff = staffMapper.selectStaffById(staffId);
        return staff;
    }

    /**查询配送员详细信息通过Id
     * @param staffId
     * @return
     */
    @Override
    public StaffVO staffInfoById(int staffId) {
        StaffVO staffVO = staffMapper.staffInfoById(staffId);
        return staffVO;
    }

    /**
     * @param staff
     * @return
     */
    @Override
    public int instertStaff(Staff staff) {
        int rows = staffMapper.insterStaff(staff);
        return rows;
    }

    /**
     * @param staff
     * @return
     */
    @Override
    public int updateStaff(Staff staff) {
        int rows = staffMapper.updateStff(staff);
        return rows;
    }

    /**
     * @param staffId
     * @return
     */
    @Override
    public int deleteStaffById(int staffId) {
        int rows = staffMapper.deleteStaffById(staffId);
        return rows;
    }

    /**
     * @param staffIds
     * @return
     */
    @Override
    public int deleteStaffByIds(List<Integer> staffIds) {
        int rows = staffMapper.deleteStaffByIds(staffIds);
        return rows;
    }
}
